// components/bind-phone/index.js
import api from "../../utils/api"
import CONFIG from '../../utils/config'
import util from '../../utils/util'
import initImg from '../../utils/initFxsImg'

const app = getApp()

Component({
    properties: {},
    options: {
        addGlobalClass: true
    },
    data: {
        show: false,
        shareImg: {
            show: false,
            img: '',
        },
    },
    methods: {
        handlerToggleModal() {
            this.setData({
                show: !this.data.show
            })
        },
        // 生成分享海报图片
        openPoster(e) {
            if (e.detail.errMsg === 'getUserInfo:ok'){
                this.handlerToggleModal()
                this.triggerEvent('sc', e.detail)
            }else{
                wx.showToast({
                    title: '生成失败',
                    icon: 'none',
                })
            }
        },
        // 下载海报
        downImg() {
            util.downImg(this.data.shareImg.img)
        },
    }
})
